package day240918.lambda.demo03;

public class Test01 {
    public static void main(String[] args) {
        MyInterfaceWithParasAndReturn my=(str)-> str.length();

        System.out.println(my.doSomething("hello world"));
    }

    public static void method1() {
        MyInterfaceWithoutParas myInterfaceWithoutParas= () -> {
            System.out.println("do something");
            System.out.println("do something");
            System.out.println("do something");
            System.out.println("do something");
        };

        myInterfaceWithoutParas.doSomething();
    }

    public static void method2() {
        //                           形参
        MyInterfaceWithParas my=(String str)->{
            System.out.println(str);
        };

        my.doSomething("hello");
    }
}

interface MyInterfaceWithoutParas {
    void doSomething();
}

interface MyInterfaceWithParas {
    void doSomething(String str);
}

interface MyInterfaceWithParasAndReturn {
    int doSomething(String str);
}
